package com.csu.service;

import com.csu.common.CommonResponse;
import com.csu.domain.Account;
import com.csu.domain.Order;
import com.csu.persistence.OrderDao;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
@MapperScan("com.csu.persistence")
public class OrderService {
    @Autowired
    private OrderDao orderDao;

    public CommonResponse<List<Order>> selectAllOrders() {
        List<Order> orders = orderDao.selectAllOrders();
        return CommonResponse.createForSuccess(200, "查询成功", orders);
    }

    public CommonResponse<Object> editStatus(Order order) {
        Boolean editStatus = orderDao.editStatus(order.getOrder_id(),order.getStatus());
        if (editStatus)
            return CommonResponse.createForSuccess("修改成功");
        else
            return CommonResponse.createForError("修改失败");
    }

//    public List<Order> selectAllOrder(){
//        return orderDao.selectAllOrder();
//    }
//
//    public void deleteOrderById(int id){
//        orderDao.deleteOrderById(id);
//    }
//
//    public void updateOrder(int id){
//        orderDao.updateOrder(id);}
//
//    //修改订单信息
//    public void editOrder(Order order){
//        orderDao.editOrder(order);
//    }
//
//    public List<Order> searchAllOrder(String content){
//        return orderDao.searchAllOrder(content);
//    }
}